package sort;

/**
 * @author zxl
 * @version 1.0
 * @date 2021/12/4 17:41
 * 冒泡排序  第一个值和第二个值进行比较，当第一个值大于第二个值时交换他们的位置
 */
public class BubbleSorting {
    public static void main(String[] args) {
        int[] a = new int[]{1,3100,5,2,11,56,32,43,12,54,76,90,31,67,45,76,53,87,21};
        for (int i = 0; i < a.length; i++) {
            int tmep;
            for (int j = i+1; j < a.length; j++) {
                if(a[i]<a[j]){
                    tmep = a[i];
                    a[i] = a[j];
                    a[j] = tmep;
                }
            }
        }
        for (int i : a) {
            System.out.print(i + " ");
        }
    }
}
